package com.core.dao;

import com.core.domain.DTO.GlhStadiumInfoDTO;
import com.core.domain.DTO.LoginUserInfoDTO;
import com.core.domain.Stadium;
import com.core.domain.User;
import org.apache.ibatis.annotations.*;
import org.springframework.stereotype.Repository;

import javax.xml.crypto.Data;
import java.util.List;

@Mapper
@Repository
public interface GlhDao {

    User queryByAccountAndPassword(@Param("user") User user);

//    @Insert("insert into user(userAccount, userPassword, age, gender, eamil, phone)  values (#{ua}, #{up}, #{age}, #{gend}), #{eamil}, #{phone}")
    void addUserByLoginUserInfoDTO(@Param("ua") String userAccount, @Param("up") String userPassword,@Param("age") int age,
                                   @Param("gend") int gender,@Param("phone") String phone,@Param("email") String email);

    LoginUserInfoDTO queryUserByAccount(@Param("loginUserInfoDTO") LoginUserInfoDTO loginUserInfoDTO);

    @Delete("delete from stadium where stadiumName = #{stadiumNam}")
    void deleteByStadiumName(@Param("stadiumNam") String stadiumName);

    @Update("update user set isDelete = 1 where userAccount = #{account}")
    void deleteByAccount(@Param("account") String account);


    Stadium queryByStadiumname(@Param("name") String name);

    @Update("update stadium set isDelete = 1 where stadiumName = #{stadiumNam}")
    void deleteByStadiumName_fake(@Param("stadiumNam") String stadiumName);

    //@Insert("insert into stadium(stadiumName,stadiumNum,description,rentalPrice,limitNum)values(#{glhStadiumInfoDTO.stadiumName}, #{glhStadiumInfoDTO.stadiumNum}, #{glhStadiumInfoDTO.description}#{glhStadiumInfoDTO.rentalPrice}, #{glhStadiumInfoDTO.limitNum})")
    void addStadium(@Param("glhStadiumInfoDTO")GlhStadiumInfoDTO glhStadiumInfoDTO);

    List<User> selectAllUsers();
}
